<?php
require_once($_SERVER["DOCUMENT_ROOT"] . '/../boberstroi_start.php');//Подключаем файл инициализации
$head = $headTitle = "Добавление нового объекта";

$adminPage = true;
$headCss = '<link rel="stylesheet" type="text/css" href="' . W_CSS . 'forms.css" />
						<link rel="stylesheet" type="text/css" href="' . W_CSS . 'ui.datepicker.css" />
						<link rel="stylesheet" type="text/css" href="' . W_CSS . 'jquery.wysiwyg.css" />';
$headJS = '<script type="text/javascript" src="' . W_JS . 'jquery.wysiwyg.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'masked_input.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'datepicker/ui.datepicker-ru.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'datepicker/ui.datepicker.js"></script>
					 <script type="text/javascript" src="' . W_JS . 'datepicker/ui.datepickerConnect.js"></script>';

if (isset($_POST['name']))
	include(FORMSUBMIT . 'object/edit.php');
elseif (isset($_GET['idObject'])) {	
	$idObject = intval($_GET['idObject']);
	$arrObject = Object::getObject($idObject);
}
else 
	$arrObject = array();

if (isset($arrObject['ID_object'])){
	$arrCrumb[0][0] = View_Object::getTypeName($arrObject['type']);
	$arrCrumb[0][1] = View_Object::getUrlNameByType($arrObject['type']);
	$arrCrumb[1][0] = $arrObject['name'];
	$arrCrumb[1][1] = 'object/' . $arrObject['ID_object'];
	$arrCrumb[2][0] = 'Редактирование';
	
	$headTitle = View_Crumb::displayTitleCrumb($arrCrumb);
	$head = View_Crumb::displayCrumb($arrCrumb);
}
else {
	
}

include(TEMPLATE . 'mainHead.php');//подключаем основные части стриницы
View_Object::showObjectEditForm($arrObject);

?>
<script type="text/javascript">
	$(function(){$('#wysiwyg').wysiwyg();});
	$("#date_first").mask("99.99.9999");
	$("#date_last").mask("99.99.9999");
</script>
  <?
include(TEMPLATE . 'mainBottom.php');//закрываем основные части страницы
?>